UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0y10zQBEa1LetL7vfcR44aW7EjxsIqBsaBPfiPh54jI='
WHERE
key_id = '659182f3d643bd2204b85011bee673156b3d792fabc95b973144a5630b611546'
AND (
token = '0y10zQBEa1LetL7vfcR44aW7EjxsIqBsaBPfiPh54jI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)