UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tq18O4VnLT+0pcWVcV3QX+LS5w9in4C287LAcS+x8SI=' 
WHERE 
  key_id = '7a0924aa9f53cdfa935e0568657b0175e4d3bd028d17eb0b778b1f9efb1b13dd' 
  AND (
    token = 'Tq18O4VnLT+0pcWVcV3QX+LS5w9in4C287LAcS+x8SI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034