UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MOkgfvxXZ3ho4mWpcmLHzIPlOFynDc7D9dGK565u7q4=' 
WHERE 
  key_id = '2f2bc3856c1fafc7020d605a7f1539ee8474ea059f02f5393946e6d9c69fd4ec' 
  AND (
    token = 'MOkgfvxXZ3ho4mWpcmLHzIPlOFynDc7D9dGK565u7q4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045