UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k8UIsZQwXAfTH1EmdkX6xPPm5cAgsHx4SD+CsZxy4sQ=' 
WHERE 
  key_id = '816535cb5eac36b4ce69ea78ec516ac45ab5ecfb084ac12b38aa901b5312c102' 
  AND (
    token = 'k8UIsZQwXAfTH1EmdkX6xPPm5cAgsHx4SD+CsZxy4sQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020