UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eai0ltrBFZzF9RgqWSfnU7qt3ycYGiFG4jIOV0prIrQ='
WHERE
key_id = '39d5e0a82c69ae51df8c5d553e41ff9d0242176f4975f253e772b6905477a9ca'
AND (
token = 'eai0ltrBFZzF9RgqWSfnU7qt3ycYGiFG4jIOV0prIrQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)