UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CFw163K+kLcsfMFs9w7k6Qah41hVn3IZoA3ynqprGjQ=' 
WHERE 
  key_id = 'bd3931414c42cd80b28a8d1edbd9e73019cd152198f95efbf6d5f339232da792' 
  AND (
    token = 'CFw163K+kLcsfMFs9w7k6Qah41hVn3IZoA3ynqprGjQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047