UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q2cscTJdg9RuiS4a6FcCBfCMLVHgkZZfwhDqLejqUL4='
WHERE
key_id = '5d8cc43c335b36775f2fb635f326844b54891fe5015c0908abd575e8b3d7dac6'
AND (
token = 'Q2cscTJdg9RuiS4a6FcCBfCMLVHgkZZfwhDqLejqUL4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)