UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TvR0u8PeOSTbpy2E8H4jcr2QsHNP+MV2pwNc28Izmcg=' 
WHERE 
  key_id = '9f7382a64b63cdf68ff84989535506db627b5e527ea5be346540adaac6bb1005' 
  AND (
    token = 'TvR0u8PeOSTbpy2E8H4jcr2QsHNP+MV2pwNc28Izmcg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050