UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z/n8AnXNuwhkX0J7RPftKRdCvpC0/ieNv+60d/ZcYWY=' 
WHERE 
  key_id = '9b42725e0e1971a4903e550541b350e777ac0948f0ed90643ef556d28bc2a82e' 
  AND (
    token = 'Z/n8AnXNuwhkX0J7RPftKRdCvpC0/ieNv+60d/ZcYWY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025