UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bmlysz3W8cpGLsmyixdvWYVSu3LwGAdhtLrHR1dYNJ8='
WHERE
key_id = '9c40b9e5793611ba9efac7944ee4282357a9bf64ce1e3fb3301fa456b68d580a'
AND (
token = 'Bmlysz3W8cpGLsmyixdvWYVSu3LwGAdhtLrHR1dYNJ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)