UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A3DU2eKIrB5o+WA/imSIRIjFJX1gnHI+zWGwcgYTVHI='
WHERE
key_id = 'b9c7d138a1f2656b7446b38aace32df5d6127dcb83926574ffb48513a9d9f5b7'
AND (
token = 'A3DU2eKIrB5o+WA/imSIRIjFJX1gnHI+zWGwcgYTVHI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)