UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aAfM0qBJNU4ewIgb5w0vCr1AFBhqB9gOESJbqQP1CDs='
WHERE
key_id = '42f23fb8b17dddf3ddb4c9977d225c4dc2ade35818bd7bdddaef9129cddc18f8'
AND (
token = 'aAfM0qBJNU4ewIgb5w0vCr1AFBhqB9gOESJbqQP1CDs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)