UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j8yuyWgrS9WyO0Uerc1dq5O5L0Bwy7AETy81H+NIqq4=' 
WHERE 
  key_id = 'a5c59049e5de95d6a90d0ea4428e3edb285ef835670bd338a6bc1f11b3b58fbd' 
  AND (
    token = 'j8yuyWgrS9WyO0Uerc1dq5O5L0Bwy7AETy81H+NIqq4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028