UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ravmWFnuKza9LK1DcS69b90iqlYLvsyEeIgpbf7I0Wc='
WHERE
key_id = 'eada5991c00a66b92b26d4dd779ee8cc809226300f0f24c45215ab0c16cebacd'
AND (
token = 'ravmWFnuKza9LK1DcS69b90iqlYLvsyEeIgpbf7I0Wc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)