UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o34lTlHC8B6fM6xH5uSKHjh3Mp5b5Wgb2B3Etj+MMwc=' 
WHERE 
  key_id = '11b62b9b2c26f3b54658372f65b0b040f1c1f8f816cd4e9e258edc53d8e06013' 
  AND (
    token = 'o34lTlHC8B6fM6xH5uSKHjh3Mp5b5Wgb2B3Etj+MMwc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022