UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A4JqJRYtH6YaRZo4Z2OA928fLW9lAQGVhKz0uPb+4H0='
WHERE
key_id = '0d5ef27eb58d41295366f4118d09733deb1182c2caa28a9a669df2c5f562b236'
AND (
token = 'A4JqJRYtH6YaRZo4Z2OA928fLW9lAQGVhKz0uPb+4H0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)