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