UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SpiSHASOzATNQTOg5k08c172UGDNraVsNsQPY4Rao4k=' 
WHERE 
  key_id = '813190f8e6e3ed1581a6552e9b94a5f069a4af1137216601a89f316bbdf28f22' 
  AND (
    token = 'SpiSHASOzATNQTOg5k08c172UGDNraVsNsQPY4Rao4k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035