UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E7D4ANzYZazcjXUP7bOBEeUt1pw8Bu6gnkhehskOWxw=' 
WHERE 
  key_id = '0ffa6dcadeb246eebe97e0d9f1ff717cc10f53e2f7eb567fb64548ac2a4c1d13' 
  AND (
    token = 'E7D4ANzYZazcjXUP7bOBEeUt1pw8Bu6gnkhehskOWxw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041