UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oyXr7vKiBjNKLHcY2zA3kd+Lx1Irkmpng6dlWyzoGSs=' 
WHERE 
  key_id = 'f9ca1c79130d0536db26aead581b505783502f1f2b714ce84b2c872168e08886' 
  AND (
    token = 'oyXr7vKiBjNKLHcY2zA3kd+Lx1Irkmpng6dlWyzoGSs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041