UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rLwxVL4nd2ZB5ynvJnPeLjU9tyOcuYaMN4oOC+120Cw='
WHERE
key_id = '4315c9c1b09d6080586e9570be73c0b6e13460792dce13b85596cf7907be671e'
AND (
token = 'rLwxVL4nd2ZB5ynvJnPeLjU9tyOcuYaMN4oOC+120Cw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)