UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XCPan7CukX7oufY7+z/5dvLrU5BwTr+w9T+kC0JpVtI=' 
WHERE 
  key_id = 'b3699bae3cab97e6aa4c39015833033531074fcf06a731cf9eb9f7f424458425' 
  AND (
    token = 'XCPan7CukX7oufY7+z/5dvLrU5BwTr+w9T+kC0JpVtI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039