UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7R1/r+7aTY/NHMzP/GNyPtABddtrFqOjEQmeSUO/jX0='
WHERE
key_id = 'b87b2898f047b4d6add0ddd8e1f5e5b30e68818257d8c28467737fae7834cc53'
AND (
token = '7R1/r+7aTY/NHMzP/GNyPtABddtrFqOjEQmeSUO/jX0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)