UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QWJPTtI3CXM49yGehLg84M9EWzW9oNXUfIyLjLm997w='
WHERE
key_id = 'aa4a8cc668e58e057d20e0a850aa5392275c2c24656bc293b835ce6a836c0aed'
AND (
token = 'QWJPTtI3CXM49yGehLg84M9EWzW9oNXUfIyLjLm997w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)