UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UhqRSS7BMmKr52p8D6b7SlBuMQaVidjBW1euzjKigaI=' 
WHERE 
  key_id = '3564374eb1d09490ca714c6161f85c9ac7bd00ea1277f36c8933d6073a7f91cf' 
  AND (
    token = 'UhqRSS7BMmKr52p8D6b7SlBuMQaVidjBW1euzjKigaI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020