UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NiBTrzvDDKmk3N0eqIuF8LdS6rR6uAtP+M3SI+mKuCQ=' 
WHERE 
  key_id = '0cfa29c52507428a3e855dfa7d150a01d4328c78c5665ade108a3e5cc1fc00f0' 
  AND (
    token = 'NiBTrzvDDKmk3N0eqIuF8LdS6rR6uAtP+M3SI+mKuCQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027