UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RnTYV66XJHqsroWLEwKetdld8/FsNBjx/NhnxuJ+Z3s='
WHERE
key_id = 'e3b50eff7096021732df0016cfc7a58fe1acfd080c97b43f89271d7fd6829842'
AND (
token = 'RnTYV66XJHqsroWLEwKetdld8/FsNBjx/NhnxuJ+Z3s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)