UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TQlk4lH8cKQfMeY+THpLzWjLq/W5xgBZgl4dOfXHuZc=' 
WHERE 
  key_id = '20e71810f1afa5e5741c8c76e034bffe469baad88822219633ef75285e712d25' 
  AND (
    token = 'TQlk4lH8cKQfMeY+THpLzWjLq/W5xgBZgl4dOfXHuZc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028