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