UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JF4PMtLg751hX79w8hL0qrJY1yLMdOElLR7t0gHF6fM=' 
WHERE 
  key_id = '1aa6fed7d09a46f981ba5fdc3a46b72b868ec5e30944c09f541dc163795be011' 
  AND (
    token = 'JF4PMtLg751hX79w8hL0qrJY1yLMdOElLR7t0gHF6fM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050