UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pGiuVgXs4nUdsPqPUZMMihrz782XSX4ilR4LPVzG0O8=' 
WHERE 
  key_id = '90d9a39894735a8355402696b23138c2423931dc037d7abe26429f5283b508b5' 
  AND (
    token = 'pGiuVgXs4nUdsPqPUZMMihrz782XSX4ilR4LPVzG0O8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038