UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J6X6r0yPZCMAg9pLsx2b4e+kF0Z1XN8+FZHFnrycAQo=' 
WHERE 
  key_id = '25d78efc92048eff6069591d5a1298eefcfb45eb131495e2545896cf7053a5fa' 
  AND (
    token = 'J6X6r0yPZCMAg9pLsx2b4e+kF0Z1XN8+FZHFnrycAQo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036