UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pexcc7PmnUMxPrBIZPI2urYD/IfCinTfVblFEr43lZs=' 
WHERE 
  key_id = '3c0decf01a361dc41db7fb3f49b4cbe4210cbba34966f56af387b39288793d2e' 
  AND (
    token = 'pexcc7PmnUMxPrBIZPI2urYD/IfCinTfVblFEr43lZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015