UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Aq2GTV+jUNZvKFeg+rX6W9pXA7dnRenRsa7/DovLQTU='
WHERE
key_id = 'd857db6b7bdd505a57a5009f125e9c3095b02e754fe6b9e1a4ebd484fa18a232'
AND (
token = 'Aq2GTV+jUNZvKFeg+rX6W9pXA7dnRenRsa7/DovLQTU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)