UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TK0JYYKQSdN1v/el0djxW7m1idM8qMy0KSEy5EiEtxk='
WHERE
key_id = '1c5800411e596cf3b3605ad6429346af0fb44d4fae7bcfb3ae8687ac383ef0bc'
AND (
token = 'TK0JYYKQSdN1v/el0djxW7m1idM8qMy0KSEy5EiEtxk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)