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

Query time 0.00033