UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KuhmiGcqjFUGzPeVpqmmop7sXDm4l3nAn9iP+MEFOew=' 
WHERE 
  key_id = '375d3b0ec23953bbd8897f62102a4fd8ae37d142f9c20e956fa1c47eccdaf181' 
  AND (
    token = 'KuhmiGcqjFUGzPeVpqmmop7sXDm4l3nAn9iP+MEFOew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026