UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2n+UMh1cKmXjL7SF9Xq6TcSlOj+frWCRzeWXhKC6o+Y=' 
WHERE 
  key_id = 'a1204dbda899cabd8ff0b1e0fab9666522a44c46b09a1d73cedb43170cf8ffc0' 
  AND (
    token = '2n+UMh1cKmXjL7SF9Xq6TcSlOj+frWCRzeWXhKC6o+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038