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